Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Datahub]: Fix missing "record not found" message #884

Merged
merged 3 commits into from
May 29, 2024
Merged

Conversation

cmoinier
Copy link
Collaborator

Description

This PR fixes the absence of the "record not found" message.

The issue was indeed linked to the userFeedbacks loading, regardless of the "notFound" error.
It was linked to the fact that userFeedBacks component only needs a metadataUuid to load, and any fake record (eg "abcd") was working with it.

This workaround simply hides the userFeedBack when the metadata does not have a title, since it's not possible to use the error state as long as a metadataUuid exists.

It also adds a e2e test to make sure this error will be caught for now on.


This work is sponsored by [IGN].

Copy link
Contributor

github-actions bot commented May 23, 2024

Affected libs: feature-record, feature-router,
Affected apps: datahub, metadata-editor, demo, webcomponents,

  • 🚀 Build and deploy storybook and demo on GitHub Pages
  • 📦 Build and push affected docker images

@coveralls
Copy link

coveralls commented May 23, 2024

Coverage Status

coverage: 86.723% (+2.4%) from 84.372%
when pulling 46f507b on fix-data-not-found
into 2b3239d on main.

Copy link
Contributor

github-actions bot commented May 23, 2024

📷 Screenshots are here!

@cmoinier cmoinier requested review from Angi-Kinas and jahow May 23, 2024 13:54
Copy link
Collaborator

@Angi-Kinas Angi-Kinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @cmoinier for fixing this issue and especially for adding a e2e test for it.

I'm still not quite sure if we should rely on the presence of the title though. But I don't have another solution atm.

@@ -70,6 +70,11 @@ export class RecordMetadataComponent {
mergeMap((uuid) => this.sourceService.getSourceLabel(uuid))
)

loadFeedBacks$ = this.metadataViewFacade.metadata$.pipe(
map((record) => record?.title),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is a use case, but what if the record doesn't have a title but all the other fields? Is there an error somewhere that we could catch instead of relying on the presence of the title?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree that it's not the best. It's just assuming that the title is the field that has the most chances to be filled...
I did try other solutions, such as using "error$" (but there was always at least one type of error that was preventing the feedbacks from loading in a working dataset). Using "isPresent$" or "metadata$" was also useless because there is indeed a metadata (made of uniqueIdentifier and title, even the fake ones).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, ok I see. Hmm... maybe @jahow has an idea for this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should rely on metadataViewFacade.isPresent$ instead :) see above in the HTML, other blocks are using it as well

Copy link
Collaborator Author

@cmoinier cmoinier May 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did try to use it, and it didn't work, because isPresent$ is always true when the feedbacks are loading (see second comment in this thread)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, so much for reading quickly... There might be an issue there because isPresent$ should be precisely used for that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will investigate that then 🙂

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the last commit, isPresent works correctly again. It turns out that the "error" state was set to null while the feedbacks were loading. I removed that, and it doesn't seem to break anything.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, well done, this must be because of this reducer: https://github.com/geonetwork/geonetwork-ui/pull/849/files#diff-4a24c2ba947113aa39efacb131d5ce9ba63caee690c409d9d321c55b30cc0b51R83-R87

I think it makes sense that way since the error clearing has to happen only once when the complete metadata starts to load.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. So is there something left to change on this PR then?

Copy link
Collaborator

@jahow jahow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing to add actually, thanks!! :)

@cmoinier cmoinier merged commit 549700b into main May 29, 2024
9 checks passed
@cmoinier cmoinier deleted the fix-data-not-found branch May 29, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants